//package com.lagou.dao;
//
//import com.lagou.io.Resources;
//import com.lagou.sqlSession.SqlSession;
//import com.lagou.sqlSession.SqlSessionFactory;
//import com.lagou.sqlSession.SqlSessionFactoryBuilder;
//import com.lagou.test.User;
//
//import java.io.InputStream;
//import java.util.List;
//
///**
// * @author lyj
// * @Title: UserDaoImpl
// * @ProjectName lagou_project
// * @Description: TODO
// * @date 2020/5/31 16:32
// */
//
//public class UserDaoImpl implements IUserDao{
//    public List<User> findAll() throws Exception{
//        InputStream resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml");
//
//        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream);
//
//      SqlSession sqlSession = sqlSessionFactory.openSession();
//
//        List<User> objects = sqlSession.selectList("user.selectList");
//        for(User user:objects) {
//            System.out.println(user);
//        }
//        return objects;
//    }
//
//    public User findByCondition() throws Exception{
//        InputStream resourceAsStream = Resources.getResourceAsStream("sqlMapConfig.xml");
//
//        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(resourceAsStream);
//
//        SqlSession sqlSession = sqlSessionFactory.openSession();
//        User user=new User();
//        user.setId(1);
//        user.setUsername("xxx");
//        User user2 = sqlSession.selectOne("user.selectOne", user);
//        System.out.println(user2);
//        return user2;
//    }
//}
